Namespace Forms.Login.Helpers


    Friend Class CtrlHelper
        Public Shared Function GetNonTransparentBackColor(ByVal ctrl As Control) As Color
            Dim bc As Color, p As Control
            Try
                p = ctrl.Parent
                bc = p.BackColor
                While bc.Equals(Color.Transparent) And Not p.Parent Is Nothing
                    p = p.Parent
                    bc = p.BackColor
                End While

                If bc.Equals(Color.Transparent) Then bc = SystemColors.Control

                Return bc
            Catch ex As Exception
                Return SystemColors.Control
            End Try
        End Function
    End Class

End Namespace
